package com.course.web.view;

import com.course.web.component.custom.CourseInfoGrid;
import com.course.web.page.AdminUI;
import com.vaadin.navigator.View;
import com.vaadin.navigator.ViewChangeListener;
import com.vaadin.spring.annotation.SpringView;
import com.vaadin.ui.CustomComponent;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * Created by Justin on 2017/5/15.
 */
@SpringView(name = CourseListView.NAME, ui = AdminUI.class)
public class CourseListView extends CustomComponent implements View {
    public static final String NAME = "course-list";

    private final CourseInfoGrid courseInfoGrid;

    @Autowired
    public CourseListView(CourseInfoGrid courseInfoGrid) {
        this.courseInfoGrid = courseInfoGrid;
        setCompositionRoot(courseInfoGrid);
        setSizeFull();
    }

    @Override
    public void enter(ViewChangeListener.ViewChangeEvent event) {
        courseInfoGrid.enter();
    }
}
